﻿package core.ui.controls
{
    import flash.display.*;
    import flash.geom.*;

    public class GradientInfo extends Sprite
    {
        public var nr:int;
        public var colors:Array;
        public var alphas:Array;
        public var ratios:Array;
        private var marked:Boolean = false;
        var mtx:Matrix;

        public function GradientInfo(param1:Array, param2:Array, param3:Array)
        {
            this.mtx = new Matrix();
            this.colors = param1;
            this.alphas = param2;
            this.ratios = param3;
            this.mtx.createGradientBox(32, 32, 45 / (180 / Math.PI), 0, 0);
            this.Redraw();
            return;
        }// end function

        public function Mark(alphas:Boolean) : void
        {
            this.marked = alphas;
            this.Redraw();
            return;
        }// end function

        public function Redraw() : void
        {
            this.graphics.clear();
            if (this.marked)
            {
                this.graphics.beginFill(0);
            }
            else
            {
                this.graphics.beginFill(9474192);
            }
            this.graphics.drawRect(0, 0, 36, 36);
            this.graphics.beginFill(16777215);
            this.graphics.drawRect(1, 1, 34, 34);
            this.graphics.beginBitmapFill(new Transparent());
            this.graphics.drawRect(2, 2, 32, 32);
            this.graphics.beginGradientFill(GradientType.LINEAR, this.colors, this.alphas, this.ratios, this.mtx);
            this.graphics.drawRect(2, 2, 32, 32);
            this.graphics.endFill();
            return;
        }// end function

    }
}
